import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.1
import PacketCap 1.0

Rectangle
{
    anchors.fill: parent
    anchors.topMargin: 20
    anchors.leftMargin: 20
    anchors.bottomMargin: 20
    anchors.rightMargin: 20

    TableView {
        id: m_devsListView
        anchors.fill: parent
        model: ListModel {}

        TableViewColumn {
            id: m_column1
            title: qsTr("source")
            role: "source_role"
            movable: false
            resizable: true
            width: m_devsListView.viewport.width/2
        }

        TableViewColumn {
            id: m_column2
            title: qsTr("description")
            role: "description_role"
            movable: false
            resizable: false
            width: m_devsListView.viewport.width - m_column1.width
        }
    }

    Component.onCompleted: {
        g_pcapHost.updateDevs()
        var devs = g_pcapHost.devs
        for (var i = 0; i < devs.length; i++) {
            m_devsListView.model.append({
                source_role: devs[i].source,
                description_role: devs[i].description
            })
        }
    }
}
